package com.cctc.mychat.client.command.impl;

import com.cctc.mychat.common.protocol.message.impl.request.ChatRequestMessage;
import io.netty.channel.Channel;

import java.util.Scanner;

public class ChatCommand extends AbstractCommand {
    @Override
    protected void run(Scanner scanner, Channel channel) {
        System.out.println("--> 请输入接收用户名称：");
        String userName = scanner.next();
        System.out.println("--> 请输入发送内容：");
        String data = scanner.next();

        ChatRequestMessage request = ChatRequestMessage
                .builder()
                .toUserName(userName)
                .data(data)
                .build();
        channel.writeAndFlush(request);
    }
}
